import QtQuick 2.0

Canvas {

    id: root
    width: 200; height: 200

    onPaint: {
        var ctx = getContext("2d")
        //(100,0)开始点 (100,200)结束点
        var gradient = ctx.createLinearGradient(100,0,100,200)
        gradient.addColorStop(0,"blue")
        gradient.addColorStop(0.5,"lightsteelblue")
        ctx.fillStyle = gradient
        ctx.fillRect(50,50,100,100)
    }

}
